/* 通用响应式样式 */

/* 基础响应式断点 */
:root {
  --mobile: 480px;
  --tablet: 768px;
  --desktop: 1024px;
  --large: 1200px;
  --xl: 1400px;
}

/* 移动端优化 */
@media (max-width: 768px) {
  /* 防止iOS缩放 */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }
  
  /* 触摸目标优化 */
  button,
  .btn,
  .btn-icon-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 表格响应式处理 */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table-responsive table {
    min-width: 600px;
  }
  
  /* 模态框优化 */
  .modal {
    margin: 10px;
    width: calc(100% - 20px);
    max-height: calc(100vh - 20px);
  }
  
  /* 表单优化 */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  
  .form-group {
    margin-bottom: 16px;
  }
  
  /* 按钮组优化 */
  .action-buttons {
    gap: 4px;
  }
  
  .btn-icon-btn {
    padding: 8px;
  }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
  /* 隐藏非关键列 */
  .data-table th:nth-child(n+4),
  .data-table td:nth-child(n+4) {
    display: none;
  }
  
  /* 紧凑布局 */
  .page-header {
    flex-direction: column;
    gap: 12px;
  }
  
  .header-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .search-section {
    flex-direction: column;
    gap: 8px;
  }
  
  /* 模态框进一步优化 */
  .modal {
    margin: 5px;
    width: calc(100% - 10px);
  }
  
  .modal-header {
    padding: 12px 16px;
  }
  
  .modal-form {
    padding: 16px;
  }
  
  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .modal-actions .btn {
    width: 100%;
  }
  
  /* 按钮尺寸调整 */
  .btn {
    padding: 8px 12px;
    font-size: 14px;
  }
  
  .btn-icon {
    font-size: 14px;
  }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
  /* 进一步隐藏列 */
  .data-table th:nth-child(n+3),
  .data-table td:nth-child(n+3) {
    display: none;
  }
  
  /* 更紧凑的间距 */
  .customer-management,
  .card-management,
  .deposit-management,
  .transaction-management {
    padding: 8px;
  }
  
  .page-header h2 {
    font-size: 16px;
  }
  
  .btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .btn-icon {
    font-size: 12px;
  }
  
  .data-table th,
  .data-table td {
    padding: 6px 8px;
    font-size: 12px;
  }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
  .modal {
    max-height: 85vh;
  }
  
  .modal-form {
    padding: 16px 24px;
  }
  
  .form-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
  }
  
  .modal-actions {
    flex-direction: row !important;
    gap: 12px !important;
  }
  
  .modal-actions .btn {
    width: auto !important;
  }
  
  /* 仪表板横屏优化 */
  .stats-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px !important;
  }
  
  .stat-card {
    padding: 12px !important;
    flex-direction: row !important;
    text-align: left !important;
  }
  
  .action-buttons {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* 大屏幕优化 */
@media (min-width: 1200px) {
  .customer-management,
  .card-management,
  .deposit-management,
  .transaction-management {
    padding: 24px;
  }
  
  .page-header h2 {
    font-size: 28px;
  }
  
  .search-section {
    gap: 20px;
  }
  
  .search-box {
    max-width: 500px;
  }
  
  .data-table th,
  .data-table td {
    padding: 16px 20px;
    font-size: 15px;
  }
  
  .modal {
    max-width: 700px;
  }
  
  .modal-form {
    padding: 32px;
  }
  
  .form-row {
    gap: 20px;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 14px 16px;
    font-size: 16px;
  }
  
  .btn {
    padding: 12px 20px;
    font-size: 16px;
  }
  
  .btn-icon {
    font-size: 18px;
  }
}

/* 超大屏幕优化 */
@media (min-width: 1400px) {
  .customer-management,
  .card-management,
  .deposit-management,
  .transaction-management {
    padding: 32px;
  }
  
  .page-header h2 {
    font-size: 32px;
  }
  
  .search-section {
    gap: 24px;
  }
  
  .search-box {
    max-width: 600px;
  }
  
  .data-table th,
  .data-table td {
    padding: 20px 24px;
    font-size: 16px;
  }
  
  .modal {
    max-width: 800px;
  }
  
  .modal-form {
    padding: 40px;
  }
  
  .form-row {
    gap: 24px;
  }
  
  .btn {
    padding: 16px 24px;
    font-size: 18px;
  }
  
  .btn-icon {
    font-size: 20px;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .customer-management,
  .card-management,
  .deposit-management,
  .transaction-management {
    background: #111827;
  }
  
  .page-header h2 {
    color: #f9fafb;
  }
  
  .table-container {
    background: #1f2937;
  }
  
  .data-table th {
    background: #374151;
    color: #d1d5db;
  }
  
  .data-table td {
    color: #f9fafb;
    border-bottom-color: #374151;
  }
  
  .search-input,
  .filter-select {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }
  
  .search-input:focus,
  .filter-select:focus {
    border-color: #3b82f6;
  }
  
  .modal {
    background: #1f2937;
    color: #f9fafb;
  }
  
  .modal-header {
    border-bottom-color: #374151;
  }
  
  .modal-header h3 {
    color: #f9fafb;
  }
  
  .form-group label {
    color: #d1d5db;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }
  
  .form-group input:focus,
  .form-group select:focus,
  .form-group textarea:focus {
    border-color: #3b82f6;
  }
  
  .customer-info,
  .card-info {
    background: #374151;
  }
  
  .customer-info p,
  .card-info p {
    color: #d1d5db;
  }
  
  .btn-primary {
    background: #3b82f6;
  }
  
  .btn-primary:hover {
    background: #2563eb;
  }
  
  .btn-secondary {
    background: #6b7280;
  }
  
  .btn-secondary:hover {
    background: #4b5563;
  }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .btn,
  .btn-icon-btn,
  .form-group input,
  .form-group select,
  .form-group textarea,
  .nav-item,
  .action-btn,
  .logout-btn,
  .stat-card {
    transition: none !important;
  }
  
  .stat-card:hover {
    transform: none !important;
  }
  
  .loading-spinner {
    animation: none !important;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .status-badge.active {
    background: #166534 !important;
    color: white !important;
  }
  
  .status-badge.inactive {
    background: #dc2626 !important;
    color: white !important;
  }
  
  .btn-primary {
    background: #1d4ed8 !important;
    border: 2px solid #1d4ed8 !important;
  }
  
  .btn-secondary {
    background: #4b5563 !important;
    border: 2px solid #4b5563 !important;
  }
  
  .data-table th {
    background: #374151 !important;
    border-bottom: 2px solid #6b7280 !important;
  }
  
  .data-table td {
    border-bottom: 1px solid #6b7280 !important;
  }
}

/* 打印样式 */
@media print {
  .admin-header,
  .sidebar,
  .header-actions,
  .search-section,
  .action-buttons,
  .modal-overlay {
    display: none !important;
  }
  
  .main-content {
    padding: 0 !important;
  }
  
  .table-container {
    box-shadow: none !important;
    border: 1px solid #000 !important;
  }
  
  .data-table {
    border-collapse: collapse !important;
  }
  
  .data-table th,
  .data-table td {
    border: 1px solid #000 !important;
    padding: 8px !important;
  }
}

/* 焦点可见性增强 */
@media (prefers-reduced-motion: no-preference) {
  .btn:focus-visible,
  .btn-icon-btn:focus-visible,
  .nav-item:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .btn:hover,
  .btn-icon-btn:hover,
  .nav-item:hover,
  .action-btn:hover {
    background-color: inherit;
    transform: none;
  }
  
  .btn:active,
  .btn-icon-btn:active,
  .nav-item:active,
  .action-btn:active {
    background-color: #e5e7eb;
    transform: scale(0.98);
  }
}

/* 宽屏设备优化 */
@media (min-width: 1600px) {
  .customer-management,
  .card-management,
  .deposit-management,
  .transaction-management {
    max-width: 1400px;
    margin: 0 auto;
  }
  
  .modal {
    max-width: 900px;
  }
  
  .form-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 超宽屏设备优化 */
@media (min-width: 1920px) {
  .customer-management,
  .card-management,
  .deposit-management,
  .transaction-management {
    max-width: 1600px;
  }
  
  .modal {
    max-width: 1000px;
  }
  
  .data-table th,
  .data-table td {
    padding: 24px 28px;
    font-size: 17px;
  }
} 